
export default {
	data() {
		return {
			titleList:[
				
				{
					id:'1',
					status:'100',
					name:'待审核',
				},
				{
					id:'2',
					status:'10',
					name:'待支付',
				},
				{
					id:'3',
					status:'111',
					name:'待派车',
				},
				{
					id:'4',
					status:'112',
					name:'待接货',
				},
				{
					id:'5',
					status:'200',
					name:'已完成',
				},
				{
					id:'6',
					status:'-1',
					name:'已取消',
				}
			], 
			reachType: [
				{name:'自送专线', type:1},
				{name:'上门提货', type:2}
			],
			deliveryType: [
				{name:'自提',    type:1},
				{name:'送货上门', type:2}
			],
			tabIndex:'',
			id:'',

			inputData:{
				reach_type:'',
				delivery_type:'',
				order_goods:[]
			},

		}
    },
    created() {
		 
	},
	onLoad(options) {
		//  this.height = uni.getSystemInfoSync().windowHeight  + 'px'
		this.id = options.id;
		this.tabIndex=this.titleList.findIndex((item)=>{
			return item.status==options.status
		}) 
		this.getDetailData();
	},
	onShow() {

	},
	methods: {
		 tabsClick(item){
			 this.tabIndex = item.index;
			 this.$util.redirectTo('/pages/tabBar/order/order', {
				tabIndex: item.tabIndex
			},'redirectTo');


		 },
		 getDetailData(){
			this.http.sendRequest({
				api: this.api.order.waybillDetailApi,
				data: {id:this.id},
				success: res => {
					if (res.code == '1' && res.data) {
						this.inputData=res.data
					}
				},
				fail: res => {
					console.log(res,'==fail')
					// this.$util.showToast({
					// 	title: msg
					// });
				}
			});
		 },
		 getOrderStatus(e) {
			var statusname = '';
			switch (e.status) {
				case 100: {
					statusname = '待报价';
					break;
				}
				case 110: {
					statusname = '已报价';
					break;
				}
				case 120: {
					statusname = '配送中';
					break;
				}
				case 200: {
					statusname = '已揽收';
					break;
				}
				case 300: {
					statusname = '转运单';
					break;
				}
				case '-1': {
					statusname = '已取消';
					break;
				}
	
				default: {
					break;
				}
			}
			return statusname;
		},
		 confirm(){
			var data = {
				...this.inputData,
			};
			this.http.sendRequest({
				api: this.api.order.sOrderUpdateApi,
				data: data,
				success: res => {
					if(res.code==1){
						this.$util.showToast({
						title: res.msg
					});
					}
					
					this.$util.redirectTo('/pages/tabBar/order/order',{},'redirectTo');
				},
				fail: res => {
					console.log(res,'==fail')
				}
			});
		 }
	}

}